package com.cadi.aux;


import com.cadi.menu.MainMenu;
import java.applet.AudioClip;
import java.awt.Font;
import java.awt.Frame;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.WindowConstants;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Luis Eduardo Garay
 */
public abstract class Window extends JFrame{
    
    protected JFrame window;
    protected JLayeredPane container;
    protected JLabel character;
    private final JLabel banner;
    protected JLabel background;
    protected JLabel playVoice;
    public static Font styleText = new Font("Comic Sans Ms", Font.BOLD, 18);
    public static Font styleMoney = new Font("Comic Sans Ms", Font.BOLD, 88);
    protected JLabel toMenu;
    protected AudioClip voice;
    protected AudioClip result;
    
    public Window(){
        window = new JFrame("Manejo del Dinero");
//        window.setSize(1280,800);
        playVoice = new JLabel(new ImageIcon(getClass().getResource("/resources/soundIcon.png")));
        playVoice.setBounds(135, 450, 50, 50);
        playVoice.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                voice.play();
            }
        });
        window.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        window.getContentPane().setLayout(null);
        window.setExtendedState(Frame.MAXIMIZED_BOTH); 
        window.setUndecorated(true);  
        container = new JLayeredPane();
        container.setLayout(null);
        background = new JLabel(new ImageIcon(getClass().getResource("/resources/apo.png")));
        container.add(background,JLayeredPane.DEFAULT_LAYER);
        background.setBounds(0, 0, 1280,800);
        banner = new JLabel(new ImageIcon(getClass().getResource("/resources/heading.png")));
        banner.setBounds(762, 0, 418, 139);
        character = new JLabel(new ImageIcon(getClass().getResource("/resources/miguelin.png")));
        character.setBounds(5, 340, 149, 300);
        container.add(character,JLayeredPane.PALETTE_LAYER);
        toMenu = new JLabel(new ImageIcon(getClass().getResource("/resources/salir.png")));
//        toMenu.setBounds(1150, 700, 100, 100);
        toMenu.setBounds(1150, 600, 100, 100);
        toMenu.addMouseListener(new MouseAdapter() {
        @Override
            public void mouseClicked(MouseEvent evt){
               MainMenu main = new MainMenu();
               window.setVisible(false);
                
            }});
        toMenu.setVisible(true);
        container.add(toMenu,JLayeredPane.PALETTE_LAYER);
        window.getContentPane().add(container);
        container.setBounds(0, 0, 1280, 800);
        container.add(playVoice, JLayeredPane.PALETTE_LAYER);
    }
}
